package server

import (
	"log/api"
	"log/dingding"
	"log/es"
	"log/nacos"
	"log/re"
	"runtime"
)

func Server() {
	//开启当前服务器全部核心并行跑任务
	runtime.GOMAXPROCS(runtime.NumCPU())
	//初始化es
	es.EsInit("http://127.0.0.1:9200")
	//初始化钉钉报警
	dingding.New("15c82358b33a3ae9c00c26b0492ad8d11b7a66e5093be5f711104065eafbc7f2")

	//从nacos拿去配置,启动相应的协程
	nc := nacos.NewObj("127.0.0.1")
	//读取配置
	conf := nc.GetConfig("server", "server")
	//消费队列初始化
	re.Init("errmsg\\[.*\\]|panic", conf, "127.0.0.1:4150")

	//启动gin路由
	api.InitRouter()
}
